Skip to content

✨ Draw the hit timer chart with Grafima - #1125

Merged
LeoColman merged 2 commits into
mainfrom
feat/hittimer-grafima
Aug 19, 2026
Merged

✨ Draw the hit timer chart with Grafima#1125
LeoColman merged 2 commits into
mainfrom
feat/hittimer-grafima

Conversation

@LeoColman

@LeoColman LeoColman commented Aug 12, 2026

Copy link
Copy Markdown
Owner

Moves the hit timer's "Why 10 seconds?" chart from GraphView to Grafima. This
was the last com.jjoe64 usage, so the dependency, its entry in the
graph-view bundle and its licensee exception all leave with it. MPAndroidChart
stays behind for the three Stats charts.

Before / after

GraphView Grafima

Both at rest, so the hold markers sit at 0 seconds on each curve. Mid-hold, at
about four seconds, the markers track up their own curves:

What changes visually:

  • Hold markers keep a dot of their own size, 6.dp against the chart's 3.dp,
    which lands about where the GraphView marker sat against its curves. This
    needed Grafima 1.2.0, which moves the dot radius onto the series; on 1.1.1 it
    was a chart-wide property and colour alone had to carry the difference, which
    left the 1.75% marker nearly invisible where the two curves run close
    together.
  • Y ticks land on 0/12/24/36/48/60 rather than 0/20/40/60, and x ticks on
    the three measured points rather than every 5 seconds. Grafima picks its own
    tick counts.
  • Vertical gridlines are switched back on to match GraphView. Reading where ten
    seconds falls is the entire point of the chart.

Two things worth knowing for the next migration

Grafima animates, GraphView did not. The old chart lived in an AndroidView,
outside Compose's clock. Once the chart moved inside it, an animation that never
settles kept Compose busy, which stalled the timer's own recomposition:
ComposeHitTimerTest's "Start" and "Reset" both failed on a 20s timeout waiting
for the countdown to advance. There is no flag to disable animation, so the
specs are snap(). That is also the behaviour we want here, since the marker
tracks a running timer and a morph spec would always draw where the hold was.

The x axis labels come from each LineDataPoint's own label, not from
axisConfig's formatter. They were rendering as 10.0 because the label was
seconds.toString(). Setting xLabelFormatter looks like the fix and does
nothing at all.

Other

holdPointOn and the two study series drop GraphView's DataPoint for a
SubjectiveHighPoint with value equality, which lets WhyTenSecondsTest stop
comparing rendered strings.

Release APK 11,076,168 -> 11,049,255 bytes (-26,913, -0.24%), measured by
building both sides. Nice counterweight to the +32 KB Grafima cost in #1124.

Verification

  • ./gradlew test detekt licensee green
  • 25 instrumented tests green on the API 34 managed device
  • assembleFdroidRelease green through R8; no com/jjoe64 entries left in the APK
  • Driven by hand on an emulator: chart renders, and the markers track along both
    curves while a hold runs

The two screenshots live on the assets/hittimer-grafima branch so they stay
out of this diff and out of main. Delete that branch whenever this merges.

🤖 Generated with Claude Code

https://claude.ai/code/session_0167SJeKBmjmzhj9gNWcZYfs

LeoColman and others added 2 commits August 11, 2026 20:58
Moves the last chart off GraphView, so com.jjoe64 leaves the project
altogether: the dependency, its bundle and its licensee exception are all
gone. MPAndroidChart stays for the three Stats charts.

Two things the swap needed that were not obvious:

Grafima animates, and GraphView did not, because it sat in an AndroidView
outside Compose's clock. An animation that never settles keeps Compose busy,
which stalled the timer's own recomposition and hung two ComposeHitTimerTest
cases on a 20s timeout. There is no flag to turn animation off, so the specs
are snapped. That is also the behaviour we want: the marker tracks a running
timer, and a morph would always draw where the hold was, not where it is.

The x axis labels come from each LineDataPoint's own label rather than from
axisConfig's formatter, so they are rounded to whole seconds. Setting
xLabelFormatter looks like it should work and does nothing.

The hold markers lose their size-15 emphasis: dot radius belongs to the chart,
not to a series, so colour is what separates them from the curves now. Same
treatment as the withdrawal charts. Vertical gridlines are switched back on to
match what GraphView drew, since reading where ten seconds falls is the point.

holdPointOn and the two study series drop GraphView's DataPoint for a
SubjectiveHighPoint, which has value equality, so WhyTenSecondsTest can stop
comparing rendered strings.

Release APK 11,076,168 -> 11,049,255 bytes (-26,913, -0.24%).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0167SJeKBmjmzhj9gNWcZYfs
Grafima 1.2.0 puts the dot radius on the series rather than only on the
chart, so the marker can outweigh the curve it marks again. It was down to
colour alone since the migration, which left the 1.75% marker nearly
invisible where the two curves run close together.

6.dp against the chart's 3.dp, which lands about where the GraphView marker
sat against its curves.
@LeoColman
LeoColman merged commit 04be761 into main Aug 19, 2026
12 checks passed
@LeoColman
LeoColman deleted the feat/hittimer-grafima branch August 19, 2026 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant